<%@ page import="org.springside.core.Constants"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<fmt:message key="workflow_portal_label1" var="workflow_portal_label1"/>
<fmt:message key="workflow_portal_label2" var="workflow_portal_label2"/>
<fmt:message key="workflow_portal_label3" var="workflow_portal_label3"/>
<fmt:message key="workflow_portal_label4" var="workflow_portal_label4"/>
<fmt:message key="workflow_portal_label5" var="workflow_portal_label5"/>

<ff:boxportlet header="${workflow_portal_label1}">
    	  <c:if test="${param.y==10}">
	         <c:set var="length" value="4"></c:set>
	      </c:if>
	      
	       <c:if test="${param.y != 10}">
	         <c:set var="length" value="${param.y}"></c:set>
	       </c:if>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-left:5px">
	<tr>
		<td valign="top">
 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="tbl_left_ico">
        <c:forEach items="${workflowFileinboxs}" var="workflowFileinbox"> 
        <tr>
                <td>
                	<!--add by liuzhengwei  2010-11-30 显示办理到期提醒图标  -->
                	<input type="hidden" id="date_${workflowFileinbox.id}" value="${workflowFileinbox.wishdate}">
		        	<input type="hidden" id="stepdate_${workflowFileinbox.id}" value="${workflowFileinbox.workflowStep.days}">
                	<img id="img_${workflowFileinbox.id}" name="imgs" style="display:none" src="<c:url value="/themes/mskin/images/workflow/overtimelimit.gif"/>" width=16 height=16 border=0 align="absmiddle" alt="<spring:message code='workflow_deptreportNotfinish_show_label14' />">
		        	<!--add by liuzhengwei  2010-11-30 显示文件紧急程度图标 -->
					<c:if test="${workflowFileinbox.workflowFile.priority!=null}">
					<img src="<c:url value="/themes/mskin/images/workflow/alarmImg${workflowFileinbox.workflowFile.priority}.gif"/>" width=16 height=16 border=0 align="absmiddle" alt="<spring:message code='workflow_importance_label${workflowFileinbox.workflowFile.priority}' />">
					</c:if>
		        	<c:if test="${workflowFileinbox.issent == 2 || workflowFileinbox.issent == 4}">
		        	<A href="#"
		        		onClick='mainJump("/modules/workflow/workflowFileinbox.do?method=edit&id=${workflowFileinbox.id}","<%=Constants.USER_THEME_FRAME %>")'
		        		title="${workflowFileinbox.workflowFile.title}">
						<c:if test="${fn:length(workflowFileinbox.workflowFile.title)> length}">
		                	${fn:substring(workflowFileinbox.workflowFile.title,0,length)}...
		                </c:if>
		                <c:if test="${fn:length(workflowFileinbox.workflowFile.title)<= length}">
		                	${workflowFileinbox.workflowFile.title}
		                </c:if> 
		        	</a>
		        	</c:if>
		        	<c:if test="${workflowFileinbox.issent == 1}">
		        	<A 	href="#"
		        		onClick='mainJump("/modules/workflow/workflowFileinbox.do?method=show&id=${workflowFileinbox.id}","<%=Constants.USER_THEME_FRAME %>")'
		        		title="${workflowFileinbox.workflowFile.title}">		        	
		        		<B>
						<c:if test="${fn:length(workflowFileinbox.workflowFile.title)> length}">
		                	${fn:substring(workflowFileinbox.workflowFile.title,0, length)}...
		                </c:if>
		                <c:if test="${fn:length(workflowFileinbox.workflowFile.title)<= length}">
		                	${workflowFileinbox.workflowFile.title}
		                </c:if>
		                </B> 
		        	</A>
						<img src="<c:url value="../../themes/${sessionScope.loginUser.theme}/home/images/new.gif"/>">
					</c:if>
		        	(<font color="#999999"><fmt:formatDate value="${workflowFileinbox.startdate}" pattern="MM-dd HH:mm"/></font>)
                </td>
              </tr>
            </c:forEach>
            <c:if test="${fn:length(workflowFileinboxs) < 1}"> <tr><td>&nbsp;</td></tr></c:if>
            <c:if test="${fn:length(workflowFileinboxs) < 2}"> <tr><td>&nbsp;</td></tr></c:if>
            <c:if test="${fn:length(workflowFileinboxs) < 3}"> <tr><td>&nbsp;</td></tr></c:if>
            <c:if test="${fn:length(workflowFileinboxs) < 4}"> <tr><td>&nbsp;</td></tr></c:if>
            <c:if test="${fn:length(workflowFileinboxs) < 5}"> <tr><td>&nbsp;</td></tr></c:if>
            
            </table> 

	<table width="100%" height="17">
        <tr>
          <td>&nbsp;</td>
          <td width="30" class="tbl_more_ico_td">
          <a href="#" class="link_portlet" onClick='mainJump("/modules/workflow/workflowFileinbox.do?method=list&ec_s_startdate=desc","<%=Constants.USER_THEME_FRAME %>")'
         	title="<fmt:message key="common_more" />"><fmt:message key="common_more" /></a></td>
        </tr>
     </table>
	</td>
	</tr>
</table>
</ff:boxportlet>
<script language="JavaScript">
initImg();
function initImg()
{
	var imgs=document.getElementsByName("imgs");
	for(var i=0;i<imgs.length;i++)
	{
		var boxId=imgs[i].id.split("_")[1];
		var wishdate=document.getElementById("date_"+boxId).value;
		var stepdate=document.getElementById("stepdate_"+boxId).value;
		if((null!=wishdate&&wishdate!="null"&&wishdate!="")||(null!=stepdate&&stepdate!="null"&&stepdate!=""&&stepdate!=0&&stepdate!="0"))
		{
			ajax(wishdate,stepdate,boxId);
		}
	}
}
function ajax(wishdate,stepdate,boxId)
{
	var url='<c:url value="/modules/workflow/workflowFileinbox.do?method=ajaxCompareNowDate"/>';
	new Ajax.Request(url, {method: 'post',postBody:'compareDate='+wishdate+'&stepdate='+stepdate+'&id='+boxId+'&flag=inbox', onSuccess:function(t){
	if(t.responseText=="true")
	{
		document.getElementById("img_"+boxId).style.display="";
	}
	}});
}
</script>
